#include <STC89C5xRC.H>
#include "delay.h"


sbit RCK=P3^5;//RCLK
sbit SCK=P3^6;//SRCLK
sbit SER=P3^4;

//74hc595写入数据
void _74hc595_writebyte(unsigned char byte)
{
	unsigned char i;
	for(i=0;i<8;i++)
	{
	SER=byte&(0x80>>i);
	SCK=1;
	SCK=0;
	}
	RCK=1;
	RCK=0;
}

//点阵显示，col列，data行 1亮0灭
void matrixled_showcolum(unsigned char col,unsigned char DATA)
{
	_74hc595_writebyte(DATA);
	P0=~(0x80>>col);
	Delayms(1);
	P0=0xff;
}

void main()
{
	SER=0;
	SCK=0;
	RCK=0;
	while(1)
	{
	matrixled_showcolum(0,0x81);
	matrixled_showcolum(1,0x42);
	matrixled_showcolum(2,0x24);
	matrixled_showcolum(3,0x18);
	matrixled_showcolum(4,0x18);
	matrixled_showcolum(5,0x24);
	matrixled_showcolum(6,0x42);
	matrixled_showcolum(7,0x81);
	}

}